<!DOCTYPE html>
<html>
<head>
    <title></title>
    <!--#parse("sys/header.html")-->
    <#include "../header.html" encoding="UTF-8"/>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16">
            &nbsp;&nbsp;
            <i-button type="ghost" @click="reload"><i class="fa fa-refresh"></i>&nbsp;刷新</i-button>
            <!--#if($shiro.hasPermission("category:save"))-->
            <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
           <!-- #end
            #if($shiro.hasPermission("category:update"))-->
            <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
           <!-- #end
            #if($shiro.hasPermission("category:delete"))-->
            <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
           <!-- #end-->
        </Row>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="category" :rules="ruleValidate" :label-width="100">
            <Form-item label="分类名称" prop="name">
                <i-input v-model="category.name" placeholder="分类名称"/>
            </Form-item>
            <Form-item label="类目编码" prop="code">
                <i-input v-model="category.code" placeholder="类目编码"/>
            </Form-item>
            <Form-item label="类目类别" prop="type">
                <Radio-group v-model="category.type">
                    <Radio label="0">
                        <span>叶</span>
                    </Radio>
                    <Radio label="1">
                        <span>枝</span>
                    </Radio>
                </Radio-group>
            </Form-item>
            <Form-item v-show="parentShow" v-if="category.type == 0" label="父类目" prop="parent.name" style="width: 288px;">
                <!--<i-select v-model="category.parent.name" v-bind:disabled="disabled">
                    <i-option value="" key="">请选择</i-option>
                    <i-option v-for="categorys in categoryList" :value="categorys.id"
                              :key="categorys.id" >{{categorys.name}}
                    </i-option>
                </i-select>-->
                <i-input v-model="category.parent.name"  v-bind:disabled="disabled"  placeholder="上级类目"/>
                <i-input v-model="category.parentCode"   type="hidden"/>
            </Form-item>

            <Form-item label="排序" prop="sort">
                <Input-number :min="0" :step="1" v-model="category.sort" placeholder="排序" style="width: 188px;"/>
            </Form-item>
          <!--  <Form-item label="首页展示排序" prop="showIndex">
                <Input-number :min="0" :step="1" v-model="category.showIndex" placeholder="首页展示排序"
                              style="width: 188px;"/>
            </Form-item>-->
            <Form-item label="显示" prop="status">
                <Radio-group v-model="category.status">
                    <Radio label="1">
                        <span>是</span>
                    </Radio>
                    <Radio label="0">
                        <span>否</span>
                    </Radio>
                </Radio-group>
            </Form-item>
            <Row><!--商品列表图-->
                <i-col span="16">
                    <Form-item label="商品列表图" prop="wapBannerUrl">
                        <i-input v-model="category.wapBannerUrl" placeholder="商品列表图" readonly/>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <Upload style="width: 300px;" action="../file/upload" :format="['jpg','jpeg','png']"
                                max-size="2048"
                                :on-success="handleSuccessWapBannerUrl" :on-format-error="handleFormatError"
                                :show-upload-list="false"
                                :on-exceeded-size="handleMaxSize">
                            <i-button icon="ios-cloud-upload-outline">上传图片</i-button>
                        </Upload>
                    </Form-item>
                </i-col>
                <i-col span="3">
                    <Form-item :label-width="1">
                        <i-button icon="eye" @click="eyeImageWapBannerUrl">预览图片</i-button>
                    </Form-item>
                </i-col>
            </Row>
          <!--  <Form-item label="frontName" prop="frontName">
                <i-input type="textarea" v-model="category.frontName" placeholder="frontName"/>
            </Form-item>-->
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>
</div>

<script src="${rc.contextPath}/static/vue/js/shop/category.js"></script>
</body>
</html>